<template>
  <div>
    <div class="hello">
      清晨的风，驱逐烦躁的心情；清晨的雾，阻挡忧伤的脚步；清晨的露，谱写快乐的音符；清晨的祝福，指引幸福的旅途。早安！
    </div>
    <br>
    <div class="main">
      <div>
        <ul class="task">
          <li class="taskBox" v-for="item in taskList" :key="item.id">
            <div>{{ item.title }}</div>
            <div>{{ item.content }}</div>
            <div></div>
          </li>
        </ul>
        <!-- 动态 -->
        <DyNamic></DyNamic>
      </div>
      <!-- 内容右侧 -->
      <div>
        <lottie-animation ref="anim" :animationData="require('@/assets/iconfont/car-loading2-data.json')" :loop="true"
          style="background-color:white; border-radius: 6%;" />
        <br>
        <el-tabs v-model="activeName" @tab-click="handleClick" class="myCollection">
          <el-tab-pane label="好友" name="first">
            <ul class="my">
              <li v-for="item in collectionList" :key="item.id">
                <div :style="`background-image: url(${item.headPortrait})`"></div>
                <div>{{ item.title }}</div>
              </li>
              <li v-for="item in collectionList" :key="item.id + 4">
                <div :style="`background-image: url(${item.headPortrait})`"></div>
                <div>{{ item.title }}</div>
              </li>
            </ul>
          </el-tab-pane>
          <el-tab-pane label="收藏" name="second">
            <ul class="my">
              <li v-for="item in collectionList" :key="item.id">
                <div :style="`background-image: url(${item.headPortrait})`"></div>
                <div>{{ item.title }}</div>
              </li>
            </ul>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>

<script>
import LottieAnimation from 'lottie-web-vue';
import headPortrait01 from '@/assets/img/headPortrait/01.png';
import headPortrait02 from '@/assets/img/headPortrait/02.jpg';
import headPortrait03 from '@/assets/img/headPortrait/03.jpg';
// 动态
import DyNamic from '@/components/DyNamic/App.vue';

export default {
  name: "WorkBench",
  data() {
    return {
      activeName: 'second',
      taskList: [
        {
          id: 1,
          title: '我的待办',
          content: '8个任务',
        }, {
          id: 2,
          title: '本周任务平均处理时间',
          content: '40分钟',
        }, {
          id: 3,
          title: '本周完成任务数',
          content: '28个任务',
        }, {
          id: 4,
          title: '异常（个）',
          content: '3'
        }
      ],
      collectionList: [
        {
          id: 1,
          title: '曲林龙',
          behavior: '新建项目',
          content: '博士顿奶茶',
          headPortrait: headPortrait01
        },
        {
          id: 2,
          title: '李柳琴',
          behavior: '删除项目',
          content: '博士顿奶茶',
          headPortrait: headPortrait02
        }, {
          id: 3,
          title: '鲤鱼',
          behavior: '新发布',
          content: '留言',
          headPortrait: headPortrait03
        },
      ]
    };
  },
  components: {
    LottieAnimation,
    DyNamic
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
      console.log('......');
      // console.log(this);
    }
  }
};
</script>

<style lang="scss" scoped>
.hello {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 136px;
  font-size: 23px;
  background-color: white;
}

.main {
  display: flex;
  height: 600px;

  >div:nth-of-type(1) {
    flex: 8;
    padding: 5px;
  }

  >div:nth-of-type(2) {
    flex: 2;
    padding: 5px;
  }
}

.task {
  display: flex;
  // justify-content: space-around;
  height: 128px;
  padding: 10px;
  background: white;

  .taskBox {
    position: relative;
    width: 25%;
    padding: 5px;

    >div:first-child {
      color: white;
    }

    >div:nth-of-type(2) {
      font-size: 24px;
    }

    >div:nth-of-type(3) {
      position: absolute;
      top: 0;
      right: 0;
      width: 1%;
      height: 80%;
      background-color: white;
    }
  }

  // 末尾无分割符
  .taskBox:nth-last-of-type(1)>div:nth-of-type(3) {
    width: 0;
  }
}

.hr {
  height: 1px;
  background-color: #000;
}

.myCollection {
  height: 40%;
  padding: 7px;
  background-color: white;
  border-radius: 6%;

  .my {
    display: flex;
    justify-content: space-around;
    align-content: space-around;
    flex-wrap: wrap;
    padding-left: 0;

    >li>div:nth-of-type(1) {
      width: 45px;
      height: 45px;
      background-size: cover;
      border-radius: 50%;
    }
  }
}
</style>
